package com.eurasia.firstapp.services;


import com.eurasia.firstapp.entities.Activity;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class ActivityService {
    private static List<Activity> activities = new ArrayList();
    int id = 1;

    public Activity addActivity(String title,String describe,String classify,String limitDate,int teamMax,int teamNumber,int teamSum){
        Activity activity = new Activity(id,title,describe,classify,limitDate,teamMax,teamNumber,teamSum);
        activities.add(activity);
        id++;
        return activity;
    }

    public List<Activity> selectAllActivity(){
        return activities;
    }

    public Activity selectActivityByID(int id){
        Activity activity = new Activity();
        for(int num=0;num<activities.size();num++){
            if (activities.get(num).getId()==id){
                activity = activities.get(num);
            }
        }
        System.out.println(activity.toString());
        return activity;

    }



}
